/**
 * AI聊天相关类型定义
 */

// AI角色
export interface Character {
  id: number
  name: string
  description: string
  personality: string
  background: string
  avatarUrl: string
  voiceConfig: string
  characterType: string
  skills: string
  systemPrompt: string
  isActive: boolean
  sortOrder: number
  createdAt: string
  updatedAt: string
}

// 角色状态
export interface CharacterStatus {
  id: number
  name: string
  status: 'online' | 'offline'
  activeConversations: number
  todayConversations: number
  avgResponseTime: number
  lastActiveTime: string
}

// 消息
export interface Message {
  id: number
  conversationId: number
  senderType: 1 | 2  // 1-用户, 2-AI角色
  content: string
  contentType: 'text' | 'voice'
  voiceUrl?: string
  emotionType?: string
  emotionIntensity?: number
  aiResponseTime?: number
  duration?: number
  createdAt: string
}

// 发送消息请求
export interface SendMessageRequest {
  characterId: number
  content: string
  contentType: 'text' | 'voice'
  conversationId?: number
  voiceUrl?: string
}

// 语音转文字请求
export interface SpeechToTextRequest {
  audioData: string  // Base64编码的音频数据
  format: string     // 音频格式：wav, mp3等
  language?: string  // 语言：zh-CN, en-US等
  enableEmotionDetection?: boolean
}

// 语音转文字响应
export interface SpeechToTextResponse {
  text: string
  confidence: number
  duration: number
  emotionType?: string
  emotionIntensity?: number
  processTime: number
}

// 文字转语音请求
export interface TextToSpeechRequest {
  text: string
  voiceType?: string  // female, male, child等
  speed?: number      // 语速：0.5-2.0
  pitch?: number      // 音调：0.5-2.0
  emotion?: string    // 情感：happy, sad, neutral等
  format?: string     // 输出格式：wav, mp3等
}

// 文字转语音响应
export interface TextToSpeechResponse {
  audioUrl: string
  fileSize: number
  duration: number
  format: string
  processTime: number
}

// 处理语音消息请求
export interface ProcessMessageRequest {
  characterId: number
  userId: number
  audioData: string  // Base64编码的音频数据
  format: string
  conversationId?: number
}

// 语音偏好设置
export interface VoicePreferences {
  id?: number
  userId: number
  preferredCharacterType: string
  voiceSpeed: number
  voicePitch: number
  autoEmotionDetection: boolean
  privacyLevel: number
  notificationEnabled: boolean
  createdAt?: string
  updatedAt?: string
}

